package com.bfly.mall.advert.dto;

import com.bfly.core.config.ResourceConfigure;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * 广告列表DTO
 *
 * @author 长沙商脉科技有限公司
 * @date 2020/9/18 22:50
 */
public class AdvertListDTO implements Serializable,Comparable<AdvertListDTO> {

    private static final long serialVersionUID = -3962203230198021008L;

    private int id;
    private String title;
    private int type;
    private boolean enable;
    private String img;
    private String link;
    private String typeName;
    private int seq;

    @Override
    public int compareTo(AdvertListDTO o) {
        return this.getSeq()-o.getSeq();
    }

    public String getUrl() {
        return StringUtils.isNotBlank(getImg()) ? ResourceConfigure.getResourceHttpUrl(getImg()) : "";
    }

    public int getSeq() {
        return seq;
    }

    public void setSeq(int seq) {
        this.seq = seq;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getEnableName() {
        return isEnable() ? "启用" : "禁用";
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }
}
